<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加商品</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" />
    <script th:src="@{/js/jquery-3.6.0.min.js}"></script>
</head>
<body>

<div class="panel panel-primary">
    <div class="panel-heading">
        <div th:replace="~{header}"></div>
    </div>
</div>

<br><br>

<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-6 text-center">
            <h4>添加商品</h4>
            <br>
        </div>
    </div>

    <form method="post" class="form-horizontal" th:object="${good}" th:action="@{/goods/add}">

        <div class="form-group has-success">
            <label class="col-sm-2 col-md-2 control-label">商品编号</label>
            <div class="col-sm-4 col-md-4">
                <input type="text" id="gid" name="gid" class="form-control" placeholder="请输入商品编号" required />
            </div>
        </div>


        <div class="form-group has-success">
            <label class="col-sm-2 col-md-2 control-label">商品名称</label>
            <div class="col-sm-4 col-md-4">
                <input type="text" id="goodsname" name="goodsname" class="form-control" placeholder="请输入商品名称" required />
            </div>
        </div>



        <div class="form-group has-success">
            <label class="col-sm-2 col-md-2 control-label">价格</label>
            <div class="col-sm-4 col-md-4">
                <input type="number" step="0.01" id="price" name="price" class="form-control" placeholder="请输入价格" required />
            </div>
        </div>


        <div class="form-group has-success">
            <label class="col-sm-2 col-md-2 control-label">数量</label>
            <div class="col-sm-4 col-md-4">
                <input type="number" id="stock" name="stock" class="form-control" placeholder="请输入商品数量" required />
            </div>
        </div>

        <div class="form-group has-success">
            <label class="col-sm-2 col-md-2 control-label">商品类型</label>
            <div class="col-sm-4 col-md-4">
                <select id="tcode" name="tcode" class="form-control" required>
                    <option th:each="type : ${goodstypes}"
                            th:value="${type.tcode}"
                            th:text="${type.tname}">
                    </option>
                </select>
            </div>
        </div>

        <!-- 提交按钮 -->
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <span style="display:inline-block;width:80px"></span>
                <button type="submit"class="btn btn-success" >添加</button>
                <span style="display:inline-block;width:40px"></span>
                <button type="reset" class="btn btn-primary" >重置</button>
            </div>
        </div>

    </form>
</div>

</body>
</html>